<template>
	<view style="height: 100vh; background-color: #FFFFFF;">
		<u-navbar title-color="#FFFFFF" height="48" back-icon-color="#FFFFFF" :border-bottom="false" :is-fixed="true" title="隐患详情"></u-navbar>
		<uc-content :loading="loading">
			<view class="list-item">
				<view class="list-bottom">
					<view>消防隐患:</view>
					<view>{{hiddenDangerInfo.name}}</view>
				</view>
			</view>
			<view class="list-item" v-if="hiddenDangerInfo.executePersonName!=null">
				<view class="list-bottom">
					<view>执行人员:</view>
					<view>{{hiddenDangerInfo.executePersonName}}</view>
				</view>
			</view>
			<view class="list-item">
				<view class="list-bottom">
					<view>执行时间:</view>
					<view>{{hiddenDangerInfo.executeTime | dateFormat}}</view>
				</view>
			</view>
			<view class="list-item">
				<view class="list-bottom">
					<view>业主名称:</view>
					<view>{{hiddenDangerInfo.enterpriseName}}</view>
				</view>
			</view>
			<view class="list-item">
				<view class="list-bottom">
					<view>隐患描述:</view>
					<view>{{hiddenDangerInfo.remark}}</view>
				</view>
			</view>
			<view class="list-item">
				<view class="list-bottom">
					<view>所属区域:</view>
					<view>{{hiddenDangerInfo.regionName}}</view>
				</view>
			</view>
			<view class="list-item">
				<view class="list-bottom">
					<view>隐患地点:</view>
					<view>{{hiddenDangerInfo.address}}</view>
				</view>
			</view>
			<view class="list-item" v-if="hidden||fileList.length>0">
				<view class="list-bottom">
					<view>完成图片:</view>
					<view class="wrap">
						<u-upload :custom-btn="true" @on-success="uploadSuccess" :deletable="false" :max-count="1" ref="uUpload" :show-progress="false" :file-list="fileList"  action="/api/admin/aliService/uploadImgAnd">
							<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
								<u-icon name="photo" size="60" color="#c0c4cc"></u-icon>
							</view>
						</u-upload>
					</view>
				</view>
			</view>
		</uc-content>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				hiddenDangerInfo: {
					ucId: ''
				},
				fileList:[],
				loading: false,
				hidden:false,
				hidden1:true
			}
		},
		onLoad(e) {
			this.hiddenDangerInfo.ucId = e.ucId
			console.log(e.ucId)
			this.ucId = e.ucId
		},
		onShow() {
			this.loading=true
			this.getInHiddenDanger(this.ucId)
		},
		methods: {
			getInHiddenDanger(val) {
				this.utils.request("/api/app/inHiddenDanger/getInHiddenDanger", {
					ucId: val
				}, "post", "app", true).then(res => {
					this.loading=false
					console.log(res)
					this.hiddenDangerInfo = res.data
					if(this.hiddenDangerInfo.completeUrl!=null){
						this.fileList=[]
						this.fileList.push({
							url:this.hiddenDangerInfo.completeUrl
						})
					}
				}).catch(error => {
					console.log(error)
				})
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	@import "@/uview-ui/libs/css/style.components.scss";
	.list-item {
		padding: 20rpx 40rpx;
		background-color: #fff;
		border-bottom: #999999 1px dashed ;
	
		.list-bottom {
			display: flex;
			margin-top: 10rpx;
			font-size: 28rpx;
			justify-content: space-between;
			color: #333;
		}
		.list-center {
			margin-top: 20rpx;
			font-size: 28rpx;
			color: #999999;
		}
	}
</style>
